'use strict';

module.exports = app => {
  const { STRING, INTEGER, TEXT, DATE,TINYINT } = app.Sequelize;

  const HelpQuestions = app.model.define('help_questions', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    question_title: {
      type: TEXT,
      allowNull: false,
      comment: '问题标题'
    },
    question_answer: {
      type: TEXT,
      allowNull: false,
      comment: '问题答案'
    },
    category: {
      type: STRING(255),
      allowNull: true,
      comment: '问题分类'
    },
    tags: {
      type: STRING(255),
      allowNull: true,
      comment: '标签，多个用逗号分隔'
    },
    created_at: DATE,
    status: { type: TINYINT, defaultValue: 1 },
    updated_at: DATE,
  }, {
    tableName: 'help_questions',
    timestamps: true,
  });

  return HelpQuestions;
};
